VERSION=3.10
BUILD=1
ARCH=i386

PKGNAME=glide_h5_dri-$VERSION-$ARCH-$BUILD
MAINTAINER="David Cantrell <david@slackware.com>"

IGNOREPATH=/tmp:/proc:/dev:/root:/var:/a
STRIPLIB=y
STRIPBIN=y

PROGNAME="Glide for Voodoo 4/5"
DESC="\
Glide $VERSION for the Voodoo4/5\n\
\n\
Includes dynamic ELF libraries and headers for Glide $VERSION\n\
built specifically for the Voodoo 4 and Voodoo 5 cards.  This\n\
particular build incorporates DRI functionality."

compile() {
   # extract the source
   mkdir Glide
   cd Glide
   tar xvzf $CWD/glide3x.tar.gz
   tar xvzf $CWD/swlibs.tar.gz
   chmod +x swlibs/include/make/ostype
   ( cd $TMP/Glide/glide3x ; ln -s $TMP/Glide/swlibs swlibs )

   # Glide3x build section
   # The Voodoo 4/5 are known as an "h5"
   cd $TMP/Glide/glide3x
   ./chores.3dfx --clean \
                 --generate \
                 --configure="--enable-fx-glide-hw=h5 --enable-fx-dri-build" \
                 --build
}

install() {
   # install Glide3x
   cd $TMP/Glide/glide3x/build
   ./build.3dfx install
   ( cd /usr/lib
     rm -rf libglide3.so.3  ; ln -sf libglide3.so.3.10.0 libglide3.so.3
     rm -rf libglide3.so    ; ln -sf libglide3.so.3 libglide3.so
     rm -rf libglide3x.so   ; ln -sf libglide3.so libglide3x.so
     rm -rf libglide3x.so.3 ; ln -sf libglide3x.so libglide3x.so.3 )

   # install documentation
   mkdir -p /usr/doc/Glide3
   cp $TMP/Glide/glide3x/glide_license.txt /usr/doc/Glide3
}

special() {
   rm -rf $PKG/usr/lib/*.a
   rm -rf $PKG/usr/lib/*.la
}
